<?php namespace Admin\Controller;

//管理员操作模型

use Admin\Model\Admin;

class LoginController extends \Hdphp\Controller\Controller{

	protected $db;

	public function __init(){
		$this->db=new Admin;
	}

	//管理员登录
	public function Login(){

		if(IS_POST)
		{
			if($this->db->login())
			{
				$this->success('登录成功','Index/index');
			}else
			{
				$this->error($this->db->getError());
			}
		}
		else
		{
			View::make();
		}

	}


	//登录验证码
	
	public function code()
	{
		Code::make();
	}

	//退出
	
	public function quit()
	{
		session_unset();
		session_destroy();
		go('login');
	}

}